﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xcj.Mes.WholeLine.DataBase.Common;

namespace Xcj.Mes.WholeLine.DataBase.Entity
{
    public class AccountEntity : BaseEntity           // 继承是一种使得一个类获取另一个类的属性和方法的方式。在这个例子中，Account类继承了BaseEntity类，这意味着Account类可以使用BaseEntity类的所有公有和保护成员（属性和方法）。
    {
        private string _cardNo = string.Empty;
        [Alias("刷卡卡号"), StringLength(16)]
        [Column("CardNo")]
        public string CardNo
        {
            get => _cardNo;
            set
            {
                _cardNo = value?.Trim();
                RaisePropertyChanged();
            }
        }

        private string _userName = string.Empty;
        [Alias("用户名"), StringLength(64)]     // 用于给属性设置别名,这样在其他地方引用这个属性时，可以使用"用户名"来代替"UserName"。UserName属性的最大长度为64个字符。如果尝试设置超过64个字符的值，编译器会报错。
        [Column("UserName")]
        public string UserName
        {
            get => _userName;
            set
            {
                _userName = value?.Trim();
                RaisePropertyChanged();
            }
        }

        private string _userID = string.Empty;
        [Alias("用户工号"), StringLength(16)]
        [Column("UserID")]
        public string UserID
        {
            get => _userID;
            set
            {
                _userID = value?.Trim();
                RaisePropertyChanged();
            }
        }

        private string _password = string.Empty;
        [Alias("密码"), StringLength(32)]
        [Column("Password")]
        public string Password
        {
            get => _password;
            set
            {
                _password = value?.Trim();
                RaisePropertyChanged();
            }
        }

        private string _role = "操作员";
        [Alias("权限"), StringLength(16)]
        [Column("Role")]
        public string Role
        {
            get => _role;
            set
            {
                _role = value?.Trim();
                RaisePropertyChanged();
            }
        }

        private bool _enable = true;
        [Alias("启用")]
        [Column("Enable")]
        public bool Enable
        {
            get => _enable;
            set
            {
                _enable = value;
                RaisePropertyChanged();
            }
        }
    }
}
